import request from '@utils/request'

// 意见建议查询
export function getAdvice (data) {
  return request({
    url: '/merchantOpinion/getOpinionList',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 获取意见分类
export function getType (data) {
  return request({
    url: '/optionType/getTypeList',
    method: 'get',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 新增意见分类
export function addType (data) {
  return request({
    url: '/optionType/addType',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除意见分类
export function deletedType (data) {
  return request({
    url: '/optionType/deletedType',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 回复意见
export function replyAdvice (data) {
  return request({
    url: '/merchantOpinion/replyMessages',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除意见建议
export function removeAdvice (data) {
  return request({
    url: '/merchantOpinion/destroyOpinion',
    method: 'get',
    params: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 修改公告信息
export function updateNotice (data) {
  return request({
    url: '/notice/update',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除公告信息
export function deleteNotice (data) {
  return request({
    url: '/notice/delete',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}


// 获取回复人
export function getManagement (data) {
  return request({
    url: '/management/getList',
    method: 'get',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 新增回复人
export function addManagement (data) {
  return request({
    url: '/management/addManagement',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除回复人
export function deleteManagement (data) {
  return request({
    url: '/management/delete',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}